package com.lee.decorate.factory;

import com.lee.decorate.service.GatewayComponent;
import com.lee.decorate.service.impl.AccessControlDecorator;
import com.lee.decorate.service.impl.IpOrOriginBlackDecorator;
import com.lee.decorate.service.impl.LogDecorator;

/**
 * @author zfl_a
 * @Desc 工厂
 * @date 2020/8/14
 * @project springboot_design_pattern
 */
public class GatewayFactory {

    public GatewayComponent getGatewayCompoent(){
        AccessControlDecorator accessControlDecorator = new AccessControlDecorator(new LogDecorator(new IpOrOriginBlackDecorator()));
        return accessControlDecorator ;
    }

    public static void main(String[] args) {
        // 测试
        GatewayComponent gatewayCompoent = new GatewayFactory().getGatewayCompoent();
        gatewayCompoent.accessManager();
    }
}
